// 让出时间片
package main

import (
    "runtime"
    "fmt"
    "time"
)

func main() {
    go func() {
        for i := 0; i < 5; i++ {
            if i == 2 {
                runtime.Gosched()
            }
            fmt.Println("Goroutine1: ", i)
        }
    }()
    go func() {
        fmt.Println("Goroutine2")
    }()
    time.Sleep(3 * time.Second)
}
